﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Omes.Services;

namespace FashionMural.Web
{
    public partial class PublicChat : System.Web.UI.Page
    {
        protected List<Omes.Model.LeaveMessage> LeaveMessages { get; set; }

        protected int CurrentPageNum { get; set; }

        protected int CountPageNum { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            int pageNum = Convert.ToInt32(Request.QueryString["pageNum"]);
            if(pageNum > 0)
            {
                CurrentPageNum = pageNum;
            }
            else
            {
                CurrentPageNum = 1;
            }
            DbServer db = new DbServer();
            int index = (CurrentPageNum - 1) * 10;
            int count = 10;
            LeaveMessages = db.GetLeaveMessages(index, 10, 2);
            DbServer db1 = new DbServer();
            CountPageNum = db.GetLeaveMessageCount(2);
        }

        protected void Check_Click(object sender, EventArgs e)
        {
            Omes.Services.DbServer db = new DbServer();
            int lid = db.AddLeaveMessage(TwoUserName.Text, LeaveContent.Text, DateTime.Now.ToString(), "", 2);
        }
    }
}